package com.googlecode.kipler.satisfiability.completion.rule.formula.uniformnotation;

import com.googlecode.kipler.syntax.formula.BooleanFormula;
import com.googlecode.kipler.syntax.formula.Formula;
import com.googlecode.kipler.syntax.formula.BooleanFormula.Operator;

public class OrBetaFormula implements BetaFormula {

	private BooleanFormula orF;

	private Formula beta1, beta2;

	private boolean valid;

	public OrBetaFormula() {
		super();
	}

	public OrBetaFormula(Formula f) {
		setBeta(f);
	}

	@Override
	public Formula getBeta() {
		return orF;
	}

	@Override
	public void setBeta(Formula f) {
		valid = false;
		if (f instanceof BooleanFormula) {
			orF = (BooleanFormula) f;
			if (orF.getOperator() == Operator.OR) {
				beta1 = orF.getLhs();
				beta2 = orF.getRhs();
				valid = true;
			}
		}
	}

	@Override
	public Formula getBeta1() {
		return beta1;
	}

	@Override
	public Formula getBeta2() {
		return beta2;
	}

	public boolean isValid() {
		return valid;
	}

}
